object ArrayCounter {
  def getCounts(arr: Array[Int], v: Int): (Int, Int, Int) = {
    arr.foldLeft((0, 0, 0)) { case ((less, equal, more), elem) =>
      if (elem < v) (less + 1, equal, more)
      else if (elem == v) (less, equal + 1, more)
      else (less, equal, more + 1)
    }
  }
}